<template>
  <div>
    <!-- 2.给dom元素加ref标签 -->
    <h2 ref="hRef">我是内容</h2>

    <button @click="changeDom">修改dom的内容</button>
  </div>
</template>
<script setup>
import { ref } from 'vue'

//1.准备容器
const hRef = ref(null)

console.log(hRef)

const changeDom = () => {
  hRef.value.innerText = '我是修改后的内容'
}
</script>
<style lang="less"></style>
